<template>
	<div class="chat-box">
	    <div class="col-main">
	        <div class="input-area">
	            <input v-model="newMessage" @keyup.enter="sendMessage" placeholder="请输入车牌">
	            <el-button class="button" @click="sendMessage" :loading="disabledSend">发送</el-button>
	        </div>
			<div>车牌所属地：{{ HomePlace }}</div>
	    </div>
	</div>
</template>

<script setup>
	// https://apii.ctose.cn/api/cy/api/
	import axios from 'axios';
	import { reactive, toRefs, onMounted } from 'vue';
	const data = reactive({
		newMessage: '',
		HomePlace: '',
	})
	const { 
		newMessage,
		HomePlace
	} = toRefs(data);
	onMounted(() => {
		
	})
	// 初音图片生成
	function sendMessage() {
		axios({
		    method:"GET",
		    url: 'https://v.api.aa1.cn/api/car-number-fl/index.php?num='+data.newMessage,
		    data: {},
		    headers: {
		        'Content-Type': 'application/json',
		    }
		})
		.then(res => {
		    // console.log(res)
			data.HomePlace = res.data.province_name + res.data.city;
		})
		.catch(error => {
		    console.error("There was an error!", error);
		});
	}
</script>

<style>
</style>